<?php
require_once('internal/Engine.base.php');
require_once('engines/zen/settings.php');

/**
 * Zen engine. Uses only css to display sites
 *
 * An engine that requires only a CSS file to style the content. All markup is embedded within.
 * @package engines
 * @author mundusnovis group
 * @version 1.0
 */
class Zen extends Engine {
    /**
     * Link to stylesheet
     * @access private
     * @var string
     */
    private $css;

    /**
     * Use stylesheet prepared for Internet Explorer
     * @access private
     * @var boolean
     */
    private $ie;

    /**
     * function Zen::__construct()
     *
     * Loads the theme name into a class variable
     */
    function __construct() {
        // Setting global variables
        global $zen;

        // Executing the default constructor
        parent::__construct();

		// Setting the theme
        $this->css = $zen['theme'];
		$this->ie = $zen['use_ie'];

		// Adding necessary header tags
		$this->head->add('link',array('rel'=>'shortcut icon', 'href'=>'images/favicon.ico'));
		$this->head->add('link',array('rel'=>'stylesheet', 'href'=>"engines/zen/themes/{$this->css}/theme.css", 'type'=>'text/css'));
    }

    /**
     * function Zen::render()
     *
     * This function describes what should the engine do when displaying the webpage.
     * @access public
     */
    public function render() {
        $this->writeMarkup();
    }

    /**
     * function Zen::writeMarkup()
     *
     * Writes the whole site markup
     * @access private
     */
    private function writeMarkup() {
    ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
 <?php
	$this->head->write();
	if ($this->ie) echo '<!--[if IE]><link rel="stylesheet" href="engines/zen/themes/'.$this->css.'/ie.css" type="text/css" /><![endif]-->'."\n";
 ?>
</head>
<body id="mae-site">
    <div id="container">
        <div id="intro">
            <div id="pageHeader">
                <h1><span><?php echo $this->title; ?></span></h1>
                <h2><span><?php echo $this->subtitle; ?></span></h2>
            </div>
            <div id="top">
                <?php $this->displayModules('top'); ?>
            </div>
        </div>
        <div id="modules">
            <div id="modules2">
				<div id="additional">
					<?php $this->displayModules('additional'); ?>
				</div>
				<div id="banner">
				    <?php $this->displayModules('banner'); ?>
				</div>
                <div id="listModules">
                    <div id="listModules2">
                        <?php $this->displayModules('lists'); ?>
                    </div>
                </div>
                <div id="user1">
                    <?php $this->displayModules('user1'); ?>
                </div>
                <div id="user2">
                    <?php $this->displayModules('user2'); ?>
                </div>
                <div id="otherModules">
                    <div id="otherModules2">
                        <?php $this->displayModules('other'); ?>
                    </div>
                </div>
            </div>
        </div>
        <div id="main">
            <div id="main2">
                <?php $this->displayModules('main'); ?>
            </div>
        </div>
        <div id="footer">
            <div id="footerText">
                <?php $this->displayFooter(); ?>
            </div>
        </div>
    </div>
    <div id="artwork1"><span></span></div>
    <div id="artwork2"><span></span></div>
    <div id="artwork3"><span></span></div>
    <div id="artwork4"><span></span></div>
    <div id="artwork5"><span></span></div>
    <div id="artwork6"><span></span></div>
</body>
</html>
    <?php
    }
    /**
     * function Zen::displayFooter()
     *
     * Displays the site footer with the information about mae. and Zen.
     * @access private
     */
    private function displayFooter() {
        echo $this->footer . ' Powered by '.MAE_PRODUCT_NAME.' using the Zen engine.';
    }

}
?>
